package zhihuilan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import zhihuilan.entity.MyStaffAddress;
import zhihuilan.mapper.MyStaffAddressMapper;
import zhihuilan.service.MyStaffAddressService;

@Service
public class MyStaffAddressServiceImpl extends ServiceImpl<MyStaffAddressMapper, MyStaffAddress> implements MyStaffAddressService {

    @Override
    public Integer updateStaffInfoAddress(MyStaffAddress myStaffAddress){
        QueryWrapper<MyStaffAddress> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("staff_id",myStaffAddress.getStaffId());
       return   baseMapper.update(myStaffAddress,queryWrapper);

    }


    @Override
    public Integer insertStaffInfoAddress(MyStaffAddress myStaffAddress) {
       return baseMapper.insert(myStaffAddress);
    }

    @Override
    public MyStaffAddress  getStaffInfoAddressByStaffId(Integer staffId){
        QueryWrapper<MyStaffAddress> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("staff_id",staffId);
        return baseMapper.selectOne(queryWrapper);
    }
}
